<template>
  <div class="container is-scroll-bar">
    <div class="main-content is-scroll-bar">
      <div class="header-container">
        <el-menu
          :default-active="activeIndex"
          mode="horizontal"
          @select="handleSelect"
          class="title"
          style="width: 100%"
        >
          <el-menu-item index="1"> 录入人员信息 </el-menu-item>
          <el-menu-item index="2"> 搜索人员信息 </el-menu-item>
          <!-- <el-menu-item index="3">安全教育培训</el-menu-item> -->
          <el-submenu index="3">
            <template slot="title">安全教育培训</template>
            <el-menu-item index="3-1">培训文件上传</el-menu-item>
            <el-menu-item index="3-2">外培计划持证统计表</el-menu-item>
            <el-menu-item index="3-3">企业内部培训或学习档案</el-menu-item>
            <el-menu-item index="3-4">个人培训或学习档案</el-menu-item>
            <el-menu-item index="3-5">参培人员花名册</el-menu-item>
          </el-submenu>
        </el-menu>
      </div>
      <div class="main">
        <transition name="fade-right" mode="out-in">
          <router-view></router-view>
        </transition>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "registerA",
  data() {
    return {
      activeIndex: "1",
      fileList: [
        {
          name: "element-plus-logo.svg",
          url: "https://element-plus.org/images/element-plus-logo.svg",
        },
        {
          name: "element-plus-logo2.svg",
          url: "https://element-plus.org/images/element-plus-logo.svg",
        },
      ],

      form: {
        addProduct: [],
        addScenicSpot: [],
        urgentDispose: "2",
      },

      tableData: [
        {
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
      ],
      tableData2: [
        {
          kong: "勘查报告",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          kong: "水保报告",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          kong: "环保报告",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          kong: "评价报告",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          kong: "设计报告",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          kong: "环境检测",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
        {
          kong: "职业危害检测",
          name: "安全证书",
          government: "公安机关",
          link: "https://www.baidu.com/",
          note: "这是备注",
        },
      ],
      rules: [],

      setMealList: [
        {
          id: "1",
          clothing: 4,
          negativeFilm: 120,
          truing: 45,
          value: 12999,
          productList: [
            {
              value: "1",
              name: "12寸琉璃水晶册",
            },
            {
              value: "2",
              name: "36寸油画框",
            },
          ],
          scenicSpotList: [
            {
              value: "1",
              name: "纳木错",
            },
            {
              value: "2",
              name: "布达拉宫",
            },
          ],
        },
      ],

      is_setMeal: {
        id: "1",
        clothing: 4,
        negativeFilm: 120,
        truing: 45,
        value: 12999,
        productList: [
          {
            value: "1",
            name: "12寸琉璃水晶册",
          },
          {
            value: "2",
            name: "36寸油画框",
          },
        ],
        scenicSpotList: [
          {
            value: "1",
            name: "纳木错",
          },
          {
            value: "2",
            name: "布达拉宫",
          },
        ],
      },
    };
  },

  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
      if (key == 1) {
        if (this.$route.path !== "/personalInformation") {
          this.$router.push("/personalInformation");
        }
      } else if (key == 2) {
        if (this.$route.path !== "/searchpersonnel") {
          this.$router.push("/searchpersonnel");
        }
      } else if (key == "3-1") {
        if (this.$route.path !== "/trainingfileupload") {
          this.$router.push("/trainingfileupload");
        }
      } else if (key == "3-2") {
        if (this.$route.path !== "/statistics") {
          this.$router.push("/statistics");
        }
      } else if (key == "3-3") {
        if (this.$route.path !== "/businessprofile") {
          this.$router.push("/businessprofile");
        }
      } else if (key == "3-4") {
        if (this.$route.path !== "/personalprofile") {
          this.$router.push("/personalprofile");
        }
      } else if (key == "3-5") {
        if (this.$route.path !== "/traineestable") {
          this.$router.push("/traineestable");
        }
      }
    },
    // gotoEdit() {
    //   if (this.$route?.path !== "/editpersonnel") {
    //     this.$router?.push("/editpersonnel");
    //   }
    // },
    // // handleExceed(files, uploadFiles) {
    // //   ElMessage.warning(
    // //     `The limit is 3, you selected ${
    // //       files.length
    // //     } files this time, add up to ${
    // //       files.length + uploadFiles.length
    // //     } totally`
    // //   );
    // // },
    // // 提交
    // submitForm(formName) {
    //   this.$refs[formName].validate((valid) => {
    //     if (valid) {
    //       console.log(this.form);
    //     } else {
    //       return false;
    //     }
    //   });
    // },
  },
};
</script>

<style lang="scss" scoped>
:deep(.el-menu--horizontal > .el-submenu .el-submenu__title) {
  height: 54px;
  line-height: 54px;
}
.fade-right-enter-active,
.fade-right-leave-active {
  transition: opacity 0.1s;
}
.fade-right-enter,
.fade-right-leave-to {
  opacity: 0;
}

body {
  min-height: 100vh;

  transition: all 0.3s ease;
}
.container {
  padding: 15px;
  overflow: auto;
  box-sizing: border-box;
  height: 100%;
  .main-content {
    background-color: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    min-width: 700px;
    height: 100%;
    .header-container {
      padding: 15px 15px;
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;

      .title {
        position: relative;
        font-weight: bold;
        color: #333;
        font-size: 15px;
        padding-left: 16px;

        &::before {
          content: "";
          width: 3px;
          height: 19px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 19px);
          position: absolute;
        }

        &::after {
          content: "";
          width: 3px;
          height: 16px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 8px);
          position: absolute;
        }
      }
    }
  }
}
.main {
  padding: 12px 15px;
}

.w-100 {
  width: 100%;
}

.item-form-content {
  display: flex;
  flex-direction: row;
  align-items: center;

  i {
    margin: 0 10px;
  }
}

.productList-content {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  height: 40px;
}

.form-content {
  padding: 0 10px;
}

.dialog-action-bar {
  text-align: center;
  margin-top: 30px;
}
</style>
